package com.foreknow.practice.lala;

public class Test {
    //定义一个整型变量并赋任意五位正整数作为初始值，输出各个位的数字之和.
    public static void main(String[] args) {

        //定义一个任意五位正整数
        int sum = (int) (Math.random()*100000);
        //先求个位值
        int ge = sum%10;
        //十位
        int shi = sum / 10%10;
        //百位值
        int bai = sum /100% 10;
        //千位
        int qian = sum/1000 %10;
        //万位值
        int wang= sum/10000 %10;
        //输出随机sum值是多少
        System.out.println("五位值:"+sum);
        //计算各个相加
        System.out.println("得数:"+ (ge+shi+bai+qian+wang));

    }
}
